package org.demo.patten.command;

/**
 * @author zhuj
 * @date 2025/3/29
 * @apiNote
 */
public class CommandTest {
    public static void main(String[] args) {
        Television tv = new Television();
        Command onCommand = new TurnOnCommand(tv);
        Command offCommand = new TurnOffCommand(tv);
        RemoteControl remote = new RemoteControl();
        remote.setCommand(onCommand);
        remote.pressButton();  // 输出：电视已打开
        remote.setCommand(offCommand);
        remote.pressButton();  // 输出：电视已关闭
    }
}
